package wibrst.data {
	
	/**
	 * ...
	 * @author wibrst@qq.com
	 */
	
	public class MsgHolder{
		
		private var _vcListeners:Vector.<Function>;
		
		static private var _si:MsgHolder;
		static public function get si():MsgHolder {
			return _si ||=  new MsgHolder;
		}
		
		private function MsgHolder() {
			this._vcListeners = new Vector.<Function>;
		}
		
		public function regListener( listener:Function ):void {
			if ( this._vcListeners.indexOf( listener ) < 0 ) {
				this._vcListeners.push( listener );
			}
		}
		
		public function sendMsg( idMsg:String, data:Object = null ):void {
			for each( var listener:Function in this._vcListeners ) {
				listener.call( null, idMsg, data );
			}
		}
		
	}

}